//
// Created by 陈成 on 2019/9/22.
//

#ifndef RV32I_CPU_REG_H
#define RV32I_CPU_REG_H

#include <iostream>

template <class T>
class Reg {
public:
    Reg(uint32_t index);

    void
    write(T v);

    T
    read();

protected:
    uint32_t id;
    T value;
};

template <class T>
Reg<T>::Reg(uint32_t index) :
    id(index) {
    value = 0;
}

template <class T>
void
Reg<T>::write(T v) {
    value = v;
}

template <class T>
T Reg<T>::read() {
    return value;
}

#endif //RV32I_CPU_REG_H
